import { EventSwitch } from "./event_switch";

export class EventGroup {
  events: Map<string, EventSwitch>;

  constructor() {
    this.events = new Map<string, EventSwitch>();
  }

  public addEvent(id: string, eventSwitch: EventSwitch) {
    this.events.set(id, eventSwitch);
    return this;
  }

  public removeEvent(id: string) {
    this.events.delete(id);
  }

  public enable(id: string, options?: any) {
    this.events.get(id)?.enable(options);
  }

  public disable(id: string) {
    this.events.get(id)?.disable();
  }

  public enableAll() {
    this.events.forEach((ele) => {
      ele.enable();
    });
  }

  public disableAll() {
    this.events.forEach((ele) => {
      ele.disable();
    });
  }
}
